def readfile(filepath):
    f = open(filepath, 'r', encoding='UTF-8')
    print(f.tell())
    for line in f:
        print(line, end='')
    else:
        print()
        print(f.tell())


def read_all(filepath):
    f = open(filepath, 'r', encoding="UTF-8")
    print(f.read())


def writefile(filepath):
    f = open(filepath, 'a', encoding='UTF-8')
    # f.write('from python')
    f.write('\nfrom python')
    f.close()


if __name__ == "__main__":
    filepath = "D:\\temp\\python.txt"
    readfile(filepath)
    # read_all(filepath)
    # writefile(filepath)
